<template>
  <div>
    <el-card class="cardBox">
      <div class="title">
        <!-- 浮动文本 -->
        <h1 class="">5-2大巷一部</h1>
        <el-button @click="alarmBtn">报警总数：0</el-button>
      </div>
      <!-- SVG 图标 -->
      <!--    <img class="svg_style" ref="svgRef" :src="EarthIcon" />-->
      <!-- 参数表格 -->
      <div style="border: 1px solid var(--el-border-color-light)">
        <el-row class="header-row">
          <el-col :span="8"></el-col>
          <el-col :span="8" class="title-col"
            ><span>5-2大巷Ⅰ部皮带参数</span></el-col
          >
          <el-col :span="8" class="status-col">
            <div class="status-container">
              <div>
                <span>通讯故障</span>
                <i class="yuan yellow"></i>
              </div>
              <div>
                <span>无故障</span>
                <i class="yuan grey"></i>
              </div>
              <div>
                <span>运行</span>
                <i class="yuan green"></i>
              </div>
              <div>
                <span>报警</span>
                <i class="yuan red"></i>
              </div>
            </div>
          </el-col>
        </el-row>
        <el-row class="threeTitle">
          <el-col :span="4">项目</el-col>
          <el-col :span="1">1</el-col>
          <el-col :span="1">2</el-col>
          <el-col :span="1">3</el-col>
          <el-col :span="4">变频器参数</el-col>
          <el-col :span="1">1</el-col>
          <el-col :span="1">2</el-col>
          <el-col :span="1">3</el-col>
          <el-col :span="4">项目</el-col>
          <el-col :span="1">状态值</el-col>
          <el-col :span="4">项目</el-col>
          <el-col :span="1">状态值</el-col>
        </el-row>
        <el-row>
          <el-col :span="4">运行电流（A）</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip1OpCurr_AI", operator.Divide, 10, 2)
          }}</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip2OpCurr_AI", operator.Divide, 10, 2)
          }}</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip3OpCurr_AI", operator.Divide, 10, 2)
          }}</el-col>
          <el-col :span="4">变频器运行回馈</el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52_GEN('RUNSts_DI', operator.NO).value ? 'green' : 'grey'
              "
            ></div
          ></el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('VFD2RunFeed_AI', operator.NO).value
                  ? 'green'
                  : 'grey'
              "
            ></div
          ></el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('VFD3RunFeed_AI', operator.NO).value
                  ? 'green'
                  : 'grey'
              "
            ></div
          ></el-col>
          <el-col :span="4">换热风机返回故障</el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('HExchFanReturnFault_DI', operator.NO).value
                  ? 'red'
                  : 'grey'
              "
            ></div
          ></el-col>
          <el-col :span="4">张紧返回故障</el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('TensionReturnFault_AI', operator.NO).value === 1
                  ? 'red'
                  : 'grey'
              "
            ></div
          ></el-col>
        </el-row>
        <el-row>
          <el-col :span="4">运行功率（KW）</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip1OpPow_AI", operator.Multiply, 0.71, 2)
          }}</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip2OpPow_AI", operator.Multiply, 0.71, 2)
          }}</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip3OpPow_AI", operator.Multiply, 0.71, 2)
          }}</el-col>
          <el-col :span="4">变频器故障回馈</el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('VFD1FaultFeed_AI', operator.NO).value === 1
                  ? 'red'
                  : 'grey'
              "
            ></div
          ></el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('VFD2FaultFeed_AI', operator.NO).value
                  ? 'red'
                  : 'grey'
              "
            ></div
          ></el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('VFD3FaultFeed_AI', operator.NO).value
                  ? 'red'
                  : 'grey'
              "
            ></div
          ></el-col>
          <el-col :span="4">换热风机运行</el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('HeatExchFanRun_AI', operator.NO).value === 1
                  ? 'green'
                  : 'grey'
              "
            ></div
          ></el-col>
          <el-col :span="4">张紧运行反馈</el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('TensionRunFeed_AI', operator.NO).value === 1
                  ? 'green'
                  : 'grey'
              "
            ></div
          ></el-col>
        </el-row>
        <el-row>
          <el-col :span="4">运行频率（HZ）</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip1OpFreq_AI", operator.Divide, 100, 2)
          }}</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip2OpFreq_AI", operator.Divide, 100, 2)
          }}</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip3OpFreq_AI", operator.Divide, 100, 2)
          }}</el-col>
          <el-col :span="4">变频器返回故障</el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('VFD1FaultReturn_DI', operator.NO).value
                  ? 'red'
                  : 'grey'
              "
            ></div
          ></el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('VFD2FaultReturn_DI', operator.NO).value
                  ? 'red'
                  : 'grey'
              "
            ></div
          ></el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('VFD3FaultReturn_DI', operator.NO).value
                  ? 'red'
                  : 'grey'
              "
            ></div
          ></el-col>
          <el-col :span="4">换热水泵运行</el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('HeatExchWPumpRun_AI', operator.NO).value === 1
                  ? 'green'
                  : 'grey'
              "
            ></div
          ></el-col>
          <el-col :span="4">制动返回故障</el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('BrakeReturnFault_AI', operator.NO).value === 1
                  ? 'red'
                  : 'grey'
              "
            ></div
          ></el-col>
        </el-row>
        <el-row>
          <el-col :span="4">水平振动（mm/s）</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip1HVib_AI", operator.NO, null, 2)
          }}</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip2HVib_AI", operator.NO, null, 2)
          }}</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip3HVib_AI", operator.NO, null, 2)
          }}</el-col>
          <el-col :span="4">电机冷却风机运行</el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('VFD1MotorCoolFanRun_AI', operator.NO).value === 1
                  ? 'green'
                  : 'grey'
              "
            ></div
          ></el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('VFD2MotorCoolFanRun_AI', operator.NO).value === 1
                  ? 'green'
                  : 'grey'
              "
            ></div
          ></el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('VFD3MotorCoolFanRun_AI', operator.NO).value === 1
                  ? 'green'
                  : 'grey'
              "
            ></div
          ></el-col>
          <el-col :span="4">换热水泵返回故障</el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('HeatExchWPumpReturnFault_DI', operator.NO).value
                  ? 'red'
                  : 'grey'
              "
            ></div
          ></el-col>
          <el-col :span="4">制动松闸反馈</el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('BrakeReleaseFeed_AI', operator.NO).value === 1
                  ? 'green'
                  : 'grey'
              "
            ></div
          ></el-col>
        </el-row>
        <el-row>
          <el-col :span="4">垂直振动（mm/s）</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip1Vib_AI", operator.NO, null, 2)
          }}</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip2Vib_AI", operator.NO, null, 2)
          }}</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip3Vib_AI", operator.NO, null, 2)
          }}</el-col>
          <el-col :span="4">电机冷却水泵运行</el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('VFD1MotorCoolWPumpRun_DI', operator.NO).value
                  ? 'green'
                  : 'grey'
              "
            ></div
          ></el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('VFD2MotorCoolWPumpRun_DI', operator.NO).value
                  ? 'green'
                  : 'grey'
              "
            ></div
          ></el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('VFD3MotorCoolWPumpRun_DI', operator.NO).value
                  ? 'green'
                  : 'grey'
              "
            ></div
          ></el-col>
          <el-col :span="4">急停汇总</el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('EmergencyStopSummary_AI', operator.NO).value === 1
                  ? 'red'
                  : 'grey'
              "
            ></div
          ></el-col>
          <el-col :span="4">华宁返回故障</el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('HNReturnFault_DI', operator.NO).value
                  ? 'red'
                  : 'grey'
              "
            ></div
          ></el-col>
        </el-row>
        <el-row>
          <el-col :span="4">U相温度（℃）</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip1UTmp_AI", operator.NO, null, 2)
          }}</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip2UTmp_AI", operator.NO, null, 2)
          }}</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip3UTmp_AI", operator.NO, null, 2)
          }}</el-col>
          <el-col :span="4">冷却风机返回故障</el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('VFD1CoolFanReturnFault_AI', operator.NO).value
                  ? 'red'
                  : 'grey'
              "
            ></div
          ></el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('VFD2CoolFanReturnFault_AI', operator.NO).value
                  ? 'red'
                  : 'grey'
              "
            ></div
          ></el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('VFD3CoolFanReturnFault_AI', operator.NO).value
                  ? 'red'
                  : 'grey'
              "
            ></div
          ></el-col>
          <el-col :span="4">紧急制动</el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('EmergencyBrake_AI', operator.NO).value === 1
                  ? 'red'
                  : 'grey'
              "
            ></div
          ></el-col>
          <el-col :span="4">换热站故障</el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('HeatExchStationFault_AI', operator.NO).value
                  ? 'red'
                  : 'grey'
              "
            ></div
          ></el-col>
        </el-row>
        <el-row>
          <el-col :span="4">V相温度（℃）</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip1VTmp_AI", operator.NO, null, 2)
          }}</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip2VTmp_AI", operator.NO, null, 2)
          }}</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip3VTmp_AI", operator.NO, null, 2)
          }}</el-col>
          <el-col :span="4">变频主从状态</el-col>
          <el-col :span="1">{{
            BPQMap[NamePD_52("VFD1MSStatus_AI", operator.NO).value]
          }}</el-col>
          <el-col :span="1">{{
            BPQMap[NamePD_52("VFD2MSStatus_AI", operator.NO).value]
          }}</el-col>
          <el-col :span="1">{{
            BPQMap[NamePD_52("VFD3MSStatus_AI", operator.NO).value]
          }}</el-col>
          <el-col :span="4">柔性制动</el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('FlexibleBrake_AI', operator.NO).value === 1
                  ? 'red'
                  : 'grey'
              "
            ></div
          ></el-col>
          <el-col :span="4">皮带保护故障</el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('BeltProtectionFault_AI', operator.NO).value === 1
                  ? 'red'
                  : 'grey'
              "
            ></div
          ></el-col>
        </el-row>
        <el-row>
          <el-col :span="4">W相温度（℃）</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip1WTmp_AI", operator.NO, null, 2)
          }}</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip2WTmp_AI", operator.NO, null, 2)
          }}</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip3WTmp_AI", operator.NO, null, 2)
          }}</el-col>
          <el-col :span="4"></el-col>
          <el-col :span="1"></el-col>
          <el-col :span="1"></el-col>
          <el-col :span="1"></el-col>
          <el-col :span="4">皮带保护运行反馈</el-col>
          <el-col :span="1"
            ><div
              class="indicator-light"
              :class="
                NamePD_52('BeltProtectionRunFeed_AI', operator.NO).value === 1
                  ? 'green'
                  : 'grey'
              "
            ></div
          ></el-col>
          <el-col :span="4">华宁-滚筒温度1（℃）</el-col>
          <el-col :span="1">{{
            NamePD_52("HNProtDrumTmp1_AI", operator.NO, null, 2)
          }}</el-col>
        </el-row>
        <el-row>
          <el-col :span="4">前轴温度（℃）</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip1FrontShaftTmp_AI", operator.NO, null, 2)
          }}</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip2FrontShaftTmp_AI", operator.NO, null, 2)
          }}</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip3FrontShaftTmp_AI", operator.NO, null, 2)
          }}</el-col>
          <el-col :span="4"></el-col>
          <el-col :span="1"></el-col>
          <el-col :span="1"></el-col>
          <el-col :span="1"></el-col>
          <el-col :span="4"></el-col>
          <el-col :span="1"></el-col>
          <el-col :span="4">华宁-滚筒温度2（℃）</el-col>
          <el-col :span="1">{{
            NamePD_52("HNProtDrumTmp2_AI", operator.NO, null, 2)
          }}</el-col>
        </el-row>
        <el-row>
          <el-col :span="4">后轴温度（℃）</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip1RearShaftTmp_AI", operator.NO, null, 2)
          }}</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip2RearShaftTmp_AI", operator.NO, null, 2)
          }}</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip3RearShaftTmp_AI", operator.NO, null, 2)
          }}</el-col>
          <el-col :span="4"></el-col>
          <el-col :span="1"></el-col>
          <el-col :span="1"></el-col>
          <el-col :span="1"></el-col>
          <el-col :span="4"></el-col>
          <el-col :span="1"></el-col>
          <el-col :span="4"></el-col>
          <el-col :span="1"></el-col>
        </el-row>
        <el-row>
          <el-col :span="4">换热站供水温度（℃）</el-col>
          <el-col :span="1">{{
            NamePD_52("Equip1RearShaftTmp_AI", operator.NO, null, 2)
          }}</el-col>
          <el-col :span="1"></el-col>
          <el-col :span="1"></el-col>
          <el-col :span="4"></el-col>
          <el-col :span="1"></el-col>
          <el-col :span="1"></el-col>
          <el-col :span="1"></el-col>
          <el-col :span="4"></el-col>
          <el-col :span="1"></el-col>
          <el-col :span="4"></el-col>
          <el-col :span="1"></el-col>
        </el-row>
        <el-row>
          <el-col :span="4">换热站回水温度（℃）</el-col>
          <el-col :span="1">{{
            NamePD_52("HERetTmp_AI", operator.NO, null, 2)
          }}</el-col>
          <el-col :span="1"></el-col>
          <el-col :span="1"></el-col>
          <el-col :span="4"></el-col>
          <el-col :span="1"></el-col>
          <el-col :span="1"></el-col>
          <el-col :span="1"></el-col>
          <el-col :span="4"></el-col>
          <el-col :span="1"></el-col>
          <el-col :span="4"></el-col>
          <el-col :span="1"></el-col>
        </el-row>
        <el-row>
          <el-col :span="4">换热站压力（Pa）</el-col>
          <el-col :span="1">{{
            NamePD_52("HEPress_AI", operator.NO, null, 2)
          }}</el-col>
          <el-col :span="1"></el-col>
          <el-col :span="1"></el-col>
          <el-col :span="4"></el-col>
          <el-col :span="1"></el-col>
          <el-col :span="1"></el-col>
          <el-col :span="1"></el-col>
          <el-col :span="4"></el-col>
          <el-col :span="1"></el-col>
          <el-col :span="4"></el-col>
          <el-col :span="1"></el-col>
        </el-row>
        <el-row>
          <el-col :span="4" class="huaning-title">华宁保护</el-col>
          <el-col :span="20">
            <div class="hn-container">
              <span
                >跑偏保护<span class="hn-span"
                  ><div
                    class="indicator-light"
                    :class="
                      NamePD_52_PT_52(
                        'PT521stDeviationReleaseSts1_DI',
                        operator.NO
                      ).value ||
                      NamePD_52_PT_52(
                        'PT521stDeviationReleaseSts2_DI',
                        operator.NO
                      ).value ||
                      NamePD_52_PT_52(
                        'PT521stDeviationReleaseSts3_DI',
                        operator.NO
                      ).value ||
                      NamePD_52_PT_52(
                        'PT521stDeviationReleaseSts4_DI',
                        operator.NO
                      ).value
                        ? 'red'
                        : 'grey'
                    "
                  ></div></span
              ></span>
              <span
                >堆煤保护<span class="hn-span"
                  ><div
                    class="indicator-light"
                    :class="
                      NamePD_52('HNProtCoalPile_DI', operator.NO).value
                        ? 'red'
                        : 'grey'
                    "
                  ></div></span
              ></span>
              <span
                >烟雾保护<span class="hn-span"
                  ><div
                    class="indicator-light"
                    :class="
                      NamePD_52('HNProtSmoke_DI', operator.NO).value
                        ? 'red'
                        : 'grey'
                    "
                  ></div></span
              ></span>
              <span
                >纵撕保护<span class="hn-span"
                  ><div
                    class="indicator-light"
                    :class="
                      NamePD_52('HNProtLongTear1_DI', operator.NO).value ||
                      NamePD_52('HNProtLongTear2_DI', operator.NO).value ||
                      NamePD_52('HNProtLongTear3_DI', operator.NO).value ||
                      NamePD_52('HNProtLongTear4_DI', operator.NO).value
                        ? 'red'
                        : 'grey'
                    "
                  ></div></span
              ></span>

              <span style="color: orange">
                终端电压（V）：
                <span>
                  {{ NamePD_52("HNProtTermVolt_AI", operator.Divide, 10, 2) }}
                </span>
              </span>
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="4" class="huaning-title">华宁沿线闭锁</el-col>
          <el-col :span="20">
            <div class="index-container">
              <div
                v-for="(item, index) in HUANINGBH"
                :key="index"
                class="index-circle"
                :class="
                  NamePD_52_PT_52(item, operator.NO).value ? 'red' : 'grey'
                "
              >
                {{ index + 1 }}
              </div>
            </div>
          </el-col>
        </el-row>
      </div>

      <div style="display: flex; justify-content: end; margin-top: 20px">
        <el-button @click="faultResetBtn">故障复位</el-button>
        <el-button @click="sensorBtn">5-2大巷皮带传感器参数</el-button>
        <el-button @click="switchBtn">5-2大巷Ⅰ部组合开关</el-button>
      </div>

      <div style="margin-top: 50px">
        <span>摄像头</span>
        <span
          >皮带速度
          {{ NamePD_52_GEN("BeltSpeed_AI", operator.Divide, 1000, 2) }}
          m/s</span
        >
      </div>

      <div style="">
        <img
          src="@/assets/images/belt1.png"
          style="width: 100%; height: 250px"
        />
      </div>
    </el-card>

    <!-- 公司log -->
    <el-row>
      <div class="kx-log-box">
        <img
          class="kx-img"
          src="@/assets/images/kxauto.png"
          alt="描述图片的文字"
        />
        <span>开轩自动化</span>

        <span class="kx-hezuo">
          商务合作：18509234888（同微信） 技术支持：18691805301（同微信）
        </span>
      </div>
    </el-row>

    
    <!-- 弹窗 -->
    <form-dialog ref="formRef" />
    <sensorFormDialog ref="sensorRef" />
    <CoalCutterHeadSwitch ref="coalCutterHeadSwitchRef" />
  </div>
</template>

<script setup lang="ts">
import { computed, onMounted, ref } from "vue";
import EarthIcon from "@/assets/images/top.svg";
import { ElMessage, ElMessageBox } from "element-plus";
import { act, createWebSocket } from "@/utils/websocket"; //引入websocket
import {
  NamePD_52,
  NamePD_52_PT_52,
  NamePD_52_GEN,
} from "@/utils/beltPositioningMethod.ts";
import { BPQMap } from "@/utils/BPQMap";
import { operator } from "@/utils/op_enums";

import formDialog from "./alarmForm.vue";
import sensorFormDialog from "./sensorForm.vue";
import CoalCutterHeadSwitch from "./coalCutterHeadSwitch.vue";

const formRef = ref();
const sensorRef = ref();
const coalCutterHeadSwitchRef = ref();
const HUANINGBH = [
  "HNLineLock1_DI",
  "HNLineLock2_DI",
  "HNLineLock4_DI",
  "HNLineLock5_DI",
  "HNLineLock6_DI",
  "HNLineLock7_DI",
  "HNLineLock8_DI",
  "HNLineLock9_DI",
  "HNLineLock10_DI",
  "HNLineLock11_DI",
  "HNLineLock12_DI",
  "HNLineLock13_DI",
  "HNLineLock14_DI",
  "HNLineLock15_DI",
  "HNLineLock16_DI",
  "HNLineLock17_DI",
  "HNLineLock18_DI",
  "HNLineLock19_DI",
  "HNLineLock20_DI",
  "HNLineLock21_DI",
  "HNLineLock22_DI",
  "HNLineLock23_DI",
  "HNLineLock24_DI",
  "HNLineLock25_DI",
  "HNLineLock26_DI",
  "HNLineLock27_DI",
  "HNLineLock28_DI",
  "HNLineLock29_DI",
  "HNLineLock3_DI",
  "HNLineLock30_DI",
  "HNLineLock31_DI",
  "HNLineLock32_DI",
  "HNLineLock33_DI",
  "HNLineLock34_DI",
  "HNLineLock35_DI",
  "HNLineLock36_DI",
  "HNLineLock37_DI",
  "HNLineLock38_DI",
];
// const NamePD_52 = (
//   key: string,
//   op: operator,
//   op_number?: number,
//   retain?: number
// ) =>
//   computed(() => {
//     return useTagResults(act.PD_52.PD_52[key], op, op_number, retain);
//   });
// const NamePD_52_PT_52 = (
//   key: string,
//   op: operator,
//   op_number?: number,
//   retain?: number
// ) =>
//   computed(() => {
//     return useTagResults(act.PD_52.PD_52_PT_52[key], op, op_number, retain);
//   });
// const NamePD_52_GEN = (
//   key: string,
//   op: operator,
//   op_number?: number,
//   retain?: number
// ) =>
//   computed(() => {
//     return useTagResults(act.PD_52.PD_52_GEN[key], op, op_number, retain);
//   });
onMounted(() => {
  createWebSocket("%PD_52%");
});
// svg 元素引用
const svgRef = ref<InstanceType<typeof EarthIcon>>();

const alarmBtn = () => {
  formRef.value.openDialog();
};
const sensorBtn = () => {
  sensorRef.value.openDialog();
};
const switchBtn = () => {
  coalCutterHeadSwitchRef.value.openDialog();
};
const faultResetBtn = () => {
  ElMessage.info("故障复位");
};
</script>

<style lang="scss" scoped>
.cardBox {
  background-color: var(--el-bg-color);
  border-radius: 8px;
  box-shadow: var(--el-box-shadow-light);
  border: 1px solid var(--el-border-color-light);

  /* 左上方标题 */
  .title {
    border-bottom: 1px solid var(--el-border-color);
    padding-bottom: 15px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;

    h1 {
      color: var(--el-text-color-primary);
      font-size: 20px;
      margin: 0;
      font-weight: 500;
    }

    .el-button {
      background-color: var(--el-color-danger);
      color: var(--el-color-white);
      border: none;
      border-radius: 4px;
      padding: 8px 15px;
      font-weight: 500;

      &:hover {
        background-color: var(--el-color-danger-light-3);
      }
    }
  }

  /* 表格标题 + 四个指示灯 */
  .header-row {
    display: flex;
    align-items: center;
    background-color: var(--el-fill-color-lighter);
    font-weight: 500;
    color: var(--el-text-color-primary);
    padding: 10px;
    .el-col {
      height: 40px;
      display: flex;
      align-items: center;
      border: 1px solid transparent;
    }

    .title-col {
      justify-content: center;

      span {
        font-size: 18px;
      }
    }

    .status-col {
      justify-content: end;
      .status-container {
        display: flex;
        gap: 14px;

        div {
          background: var(--el-fill-color-blank);
          border: 1px solid var(--el-border-color-lighter);
          border-radius: 4px;
          padding: 4px 8px;
          display: flex;
          align-items: center;
          gap: 6px;
          font-size: 13px;

          span {
            padding: 0 4px;
          }

          .yuan {
            width: 12px;
            height: 12px;
            border-radius: 50%;
            flex-shrink: 0;
            @extend %status-colors;
          }
        }
      }
    }
  }

  /* 表格的标题 项目 + 状态值 */
  .threeTitle {
    .el-col {
      background-color: var(--el-fill-color) !important;
    }
  }

  /* 每一小格子的边框 背景色 */
  .el-col {
    border: 1px solid var(--el-border-color-lighter);
    text-align: center;
    padding: 6px 5px;
    font-size: 13px;
    color: var(--el-text-color-regular);

    &:first-child,
    &:nth-child(5),
    &:nth-child(9),
    &:nth-child(11) {
      font-weight: 500;
      // color: blue;
      color: var(--el-text-color-primary);
      background-color: var(--el-fill-color-lighter);
    }
  }

  /* 子页面设备参数--指示灯 */
  .indicator-light {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--el-border-color);
    margin: 0 auto;
    @extend %status-colors;
  }

  /* 华宁沿线闭锁 */
  .huaning-title {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--el-text-color-primary);
    font-weight: 500;
  }

  .hn-container {
    display: flex;
    flex-wrap: wrap;
    gap: 50px;
    padding: 8px;
    align-items: center;
    background-color: var(--el-fill-color-lighter);
    border-radius: 4px;

    span {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .hn-span {
      display: inline-flex;
      align-items: center;
    }
  }

  .index-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    justify-content: flex-start;
    background-color: var(--el-fill-color-lighter);
    border-radius: 4px;
    min-height: 40px;
    align-items: center;
  }

  .index-circle {
    width: 26px;
    height: 26px;
    background-color: var(--el-border-color);
    border-radius: 50%;
    color: var(--el-text-color-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    font-weight: 500;
    @extend %status-colors;
  }

  // 定义基础颜色类（只定义一次）
  %status-colors {
    &.green {
      background-color: var(--el-color-success);
    }
    &.red {
      background-color: var(--el-color-danger);
    }
    &.yellow {
      background-color: var(--el-color-warning);
    }
    &.grey {
      background-color: var(--el-border-color-dark); // 比默认边框色更深的灰色
    }
  }
}
</style>
